'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const {
		mobile,
		password
	} = event
	const {
		result
	} = await uniCloud.callFunction({
		name: "user_query",
		data: {
			mobile
		}
	})
	if (result.code != -1) {
		return {
			code: -1,
			mes: "账号已存在"
		}
	}
	//返回数据给客户端
	return await db.collection("school_user_info").add({
		mobile,
		password
	})
};